package com.orange.core.pojo.entity.order;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.orange.core.pojo.entity.ICreateModel;
import com.orange.core.pojo.entity.IIntIdModel;
import com.orange.core.pojo.enums.EPayWay;
import com.orange.core.pojo.enums.ERefundStatus;
import com.orange.core.pojo.enums.EWriteOffStatus;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Accessors(chain = true)
@TableName(autoResultMap = true)
public class CreditOrder implements IIntIdModel<CreditOrder>, ICreateModel<CreditOrder> {

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 订单号
     */
    private String orderNo;

    /**
     * 用户id
     */
    private Integer userId;

    @TableField(exist = false)
    private String phone;

    /**
     * 积分商品id
     */
    private Integer creditProductId;

    /**
     * 商户id
     */
    private Integer shopId;

    /**
     * 商品名
     */
    private String productName;

    /**
     * 商品封面图
     */
    private String productCoverImage;

    /**
     * 商品图片
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<String> productPics;

    /**
     * 商品积分
     */
    private Integer productCredit;

    /**
     * 商品价格
     */
    private BigDecimal productPrice;

    /**
     * 商品领取门店
     */
    private String productShopName;

    /**
     * 商品领取门店地址
     */
    private String productShopAddress;

    /**
     * 门牌号
     */
    @TableField(exist = false)
    private String shopNumber;

    @TableField(exist = false)
    private Integer floorId;

    /**
     * 楼层
     */
    @TableField(exist = false)
    private String floorName;

    /**
     * 数量
     */
    private Integer quantity;

    /**
     * 抵扣积分
     */
    private Integer paidCredit;

    /**
     * 支付方式，1 积分抵扣，2 微信支付
     *
     * @see EPayWay
     */
    private Integer payWay;

    /**
     * 核销码
     */
    private String writeOffNo;

    /**
     * 核销状态：0待核销，1已核销
     *
     * @see EWriteOffStatus
     */
    private Integer writeOffStatus;

    /**
     * 核销时间
     */
    private LocalDateTime writeOffTime;

    /**
     * 核销人
     */
    private Integer writeOffBy;

    /**
     * 退款状态：0未退款，1已退款
     *
     * @see ERefundStatus
     */
    private Integer refundStatus;

    /**
     * 退款原因
     */
    private String refundReason;

    /**
     * 退款说明
     */
    private String refundRemark;

    /**
     * 退款时间
     */
    private LocalDateTime refundTime;

    /**
     * 退款人
     */
    private Integer refundBy;

    /**
     * 退款申请状态：0未申请，1待审核，2审核通过，3审核拒绝，4已取消
     */
    private Integer refundApplyStatus;

    /**
     * 退款申请时间
     */
    private LocalDateTime refundApplyTime;

    /**
     * 审核人
     */
    private Integer auditBy;

    /**
     * 审核时间
     */
    private LocalDateTime auditTime;

    /**
     * 审核备注
     */
    private String auditRemark;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @TableField(fill = FieldFill.INSERT)
    private Integer createBy;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private LocalDateTime createTime;
}
